﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Forms.Core;

namespace ContourStrikesAgain.FieldSettingTypes
{
    public class MemberPropertyMapper: FieldSettingType  {
    
        private Controls.MemberPropertyMapper mpm;

        private string _val = "";
        public override string Value {
            get {
                if(mpm != null)
                    _val = mpm.Value;

                return _val;
            }
            set {
                if (!string.IsNullOrEmpty(value))
                   _val = value;
            }
        }

        public override System.Web.UI.WebControls.WebControl RenderControl(Umbraco.Forms.Core.Attributes.Setting setting, Form form) {
            mpm = new Controls.MemberPropertyMapper(setting, form);
            mpm.Value = _val;
            return mpm;
        }
    }
}